package com.lfy.kcat.content.controller;

import com.lfy.kcat.content.minio.template.MinioTemplate;
import org.dromara.common.core.domain.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.multipart.MultipartFile;

/**
 * 文件上传
 * @ClassName:content/UpLoadController.java
 * @Description:
 * @Author: lfy
 * @Date: 2023/10/23 16:05
 */

// ... existing code ...
@RestController
public class UpLoadController {
    @Autowired
    MinioTemplate minioTemplate;
//    上传文件
    @PostMapping("/upload")
    public R uploadFile(@RequestParam("file") MultipartFile file) {
        String url= minioTemplate.uploadWebFile(file);
        // 可以添加文件处理逻辑
        return R.ok("上传成功", url);
    }

}
